/*
 * comlan
 */

package com.promfy.service.log;

import java.util.Random;

import com.promfy.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;


public class LogServiceActivity extends Activity {
	 private static final String TAG = "log";

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		Intent intent = new Intent(this, LogService.class);
		startService(intent);
		Log.d(TAG, "log onCreate().................");
		new Thread(new Runnable() {
			Random random = new Random(1000);
			@Override 
			public void run() {
				while(true){
					Log.d("log", "" + random.nextInt() );
					try {
						Thread.sleep(500);
					} catch (InterruptedException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					} 
				}
			} 
		}).start();
	}

	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
		Log.d(TAG, "log onDestroy().................");
		Intent intent = new Intent(this, LogService.class);
		stopService(intent);
	}
}
